package p2p.logic.connection;

import p2p.logic.connection.communication.message.Message;
import p2p.logic.connection.communication.message.CommandVisitor;

public class Command {

	protected Message message;
	protected CommandVisitor visitor;
	
	
	public Command(){
		
	}
	
	public Command(CommandVisitor v){
		this.message = v.getMessage();
		this.visitor = v;
	}
	
	public void setMessage(Message message){

		this.message = message;
	
	}
	
	public Command getCommand(){
		
		return this.visitor.getCommand();
		
	}
	
	public void execute(){
		this.visitor.execute();
	}
	
	public int getCommandCode(){
		return this.visitor.getCommandCode();
	}
	
	public CommandVisitor getVisitor(){
		return this.visitor;
	}
}
